<?php

namespace Home\Controller;
use Think\Controller;

class WxController extends Controller {

	protected $wechat = null;

	public function __construct() {
		
		parent::__construct();


		$options = array(
 			// 'token'=>'tokenaccesskey', //填写你设定的key
 			// 'encodingaeskey'=>'encodingaeskey', //填写加密用的EncodingAESKey
 			'appid'=>'wxb961bd042477b391', //填写高级调用功能的app id
 			'appsecret'=>'a7fa143d331526483162bbf1cf4ba88a' //填写高级调用功能的密钥
 		);
		$this->wechat = new \Home\Common\wechat($options);
	}

	public function index() {
		$url = $this->wechat->getOauthRedirect('http://bonus.365jinbi.com/Home/Wx/getOpenId','snsapi_userinfo');
    	
    	// echo $url;
    	//https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9872db3c2ac557c3&redirect_uri=http%3A%2F%2Flot.jxfcls.com%2FHome%2FWx%2FgetOpenId&response_type=code&scope=snsapi_userinfo&state=snsapi_base#wechat_redirect
    	$this->assign('url',$url);
    	$this->display('index');
	}


    /**
     * [获取openid]
     * @return [type] [description]
     */
    public function getOpenId() {

    	//获取openid
    	$result = $this->wechat->getOauthAccessToken();


    }





}